<?php 
	include($_SERVER['DOCUMENT_ROOT']."/headerins.php");
?>

<?php

	include($_SERVER['DOCUMENT_ROOT']."/headerFrame.php");

echo '
		<div id="contextCaption">Изменение товара.</div>
        <div id="response"></div>
        <hr>
        <form action="javascript:Request('."'".'Material'."'".', '."'".'update'."'".', '."'".''."'".')" method="POST">

            <table border="0" id="contextGrid" cellspacing="0" width="100%">



		<tr><th><label for="Code">Код товара</label><input type="text"    id="Code" value="'.$_GET['code'].'" style="width: 80%;"></th></tr>
		<tr><th><label for="Name">Наименование</label><input type="text"    id="Name" value="'.$_GET['name'].'" style="width: 80%;"></th></tr>
		<tr><th><label for="MatGroup">Группа материалов</label>
					<select id="MatGroup" style="width: 80%;">
';
?>

						<?php
								$result = mysql_query("
									SELECT 
										Id, Name
									FROM matgroup");
								
								$rows = array();
								while($row = mysql_fetch_array($result)){
								   if($_GET['groupid'] == $row['Id']) 	
											echo '<option selected="selected" value="'.$row['Id'].'">'.$row['Name'].'</option>';  
									else 
											echo '<option value="'.$row['Id'].'">'.$row['Name'].'</option>';  
								}
						?>
<?php
echo '
					</select>	


		</th></tr>
		<tr><th><label for="MatDimension">Ед. измерения</label>
					<select id="MatDimension" style="width: 80%;">
	';
	?>

						<?php

								$result = mysql_query("
									SELECT 
										Id, Name
									FROM matdimension");
								
								$rows = array();
								while($row = mysql_fetch_array($result)){
								   if($_GET['dimensionid'] == $row['Id']) 	
											echo '<option selected="selected" value="'.$row['Id'].'">'.$row['Name'].'</option>';  
									else 
											echo '<option value="'.$row['Id'].'">'.$row['Name'].'</option>';  
								}
						?>
	<?php
	echo '
					</select>	


		</th></tr>
		<tr><th><label for="Price1">Цена</label><input type="text"    id="Price1" value="'.$_GET['price1'].'" style="width: 80%;"></th></tr>
		<tr><th><label for="Price2">Цена2</label><input type="text"    id="Price2" value="'.$_GET['price2'] .'" style="width: 80%;"></th></tr>
		<tr><th><label for="Ball">Балл</label><input type="text"    id="Ball" value="'.$_GET['ball'].'" style="width: 80%;"></th></tr>
		<tr><th><label for="Active">Актив</label><input type="checkbox" checked="checked"  id="Active" value="'.$_GET['active'].'"></th></tr>



            </table>
            <hr>
            <div id="result"><div>
            <input type="hidden"  id="ID" value="'.$_GET['id'].'">
            <input id="action" type="hidden" value="update">                
            <input id="button" type="Button"  value="Отмена" title="Отменить измение" onclick="getPage('."'".'/core/Material/MaterialView.php'."'".')">            
            <input id="button" type="submit" value="Сохранить" title="Сохранить измение">
        </form>
';
?>
